package com.yyyzzz.Filter;

import javax.servlet.*;
import java.io.IOException;
//省去了Servlet设置编码步骤，过滤Servlet编码
public class Filter implements javax.servlet.Filter {
    public void init (FilterConfig filterConfig) throws ServletException {
        System.out.println ("开始了吗");
    }

    public void doFilter (ServletRequest Request , ServletResponse Response , FilterChain Chain) throws IOException, ServletException {
        Request.setCharacterEncoding ("utf-8");
        Response.setCharacterEncoding ("utf-8");
        Response.setContentType ("text/html;charset=UTF-8");
        Chain.doFilter (Request , Response);
    }

    public void destroy () {
        System.out.println ("已经结束了");
    }
}
